﻿<Window xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
        x:Class="FileserverWPF.MainWindow"
        xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:model="clr-namespace:FileserverWPF.Models"
        Title="MainWindow" Height="350" Width="525">
    <Window.DataContext x:Name="MyList">
        <model:FileServerModel />
    </Window.DataContext>
    <Window.Resources>
        <Style TargetType="ToggleButton" x:Key="Expander">
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="Button" Storyboard.TargetProperty="Opacity" To="0"/>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="ButtonOver" Storyboard.TargetProperty="Opacity" To="1"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="Opacity" To="0"/>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="Opacity" To="0"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="Opacity" To="1"/>
                                            <DoubleAnimation Duration="0:0:0.05" Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="Opacity" To="1"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                        <Grid>
                            <Grid x:Name="Button" Margin="0,7,4,0" HorizontalAlignment="Right"
                                  VerticalAlignment="Top" Width="11" Height="11">
                                <Grid.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#3F047BA5" Offset="0.996"/>
                                        <GradientStop Color="#00000000" Offset="0"/>
                                    </LinearGradientBrush>
                                </Grid.Background>
                                <Rectangle Stroke="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" Width="11" Height="11"/>
                                <Rectangle x:Name="ColapsedVisual" Fill="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" 
                                           Width="1" Height="5" Margin="5,3,0,0"/>
                                <Rectangle Fill="#FF000000" HorizontalAlignment="Left" VerticalAlignment="Top" 
                                           Width="5" Height="1" Margin="3,5,0,0"/>
                            </Grid>
                            <Grid x:Name="ButtonOver" Margin="0,7,4,0" HorizontalAlignment="Right"
                                  VerticalAlignment="Top" Width="11" Height="11">
                                <Rectangle Stroke="#FF167497" HorizontalAlignment="Left" VerticalAlignment="Top" Width="11" Height="11">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#26167497" Offset="1"/>
                                            <GradientStop Color="#00167497" Offset="0"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="ColapsedVisualOver" Fill="#FF167497" HorizontalAlignment="Left" VerticalAlignment="Top" 
                                           Width="1" Height="5" Margin="5,3,0,0"/>
                                <Rectangle Fill="#FF167497" HorizontalAlignment="Left" VerticalAlignment="Top" 
                                           Width="5" Height="1" Margin="3,5,0,0"/>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <HierarchicalDataTemplate x:Key="Folder" ItemsSource="{Binding Folders}">
            <TextBlock Text="{Binding Name}"/>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="File" ItemTemplate="{StaticResource Folder}" ItemsSource="{Binding Files}">
            <TextBlock Text="{Binding Name}"/>
        </HierarchicalDataTemplate>
    </Window.Resources>
    <telerikQuickStart:QuickStart.ExampleHeader>
        <Grid>
            <TextBlock Text="Folders" Margin="8"/>
        </Grid>
    </telerikQuickStart:QuickStart.ExampleHeader>
    <Grid>
        <Border telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"/>
        <my:RadTreeView Margin="5" ExpanderStyle="{Binding Source={StaticResource MyList}}" />
    </Grid>
</Window>
